using System.Reflection;
using ODX.Core;

namespace ODX.GettingStarted
{
    // Define a simple persistent type.
    [Table]
    public abstract class Person : Entity
    {
        public abstract string Name { get; set; }
    }

    public class Program
    {
        static void Main()
        {
            // Create a session object and XML data provider.
            Session session = new Session(new XmlDataProvider("hello.xml"));

            // Register all persistent types in assembly.
            session.RegisterAssembly(Assembly.GetExecutingAssembly());

            // Create all metadata (proxy classes, schema dataset, etc.)
            session.Prepare();

            // Create an entity of type Person
            Person john = session.Create<Person>();

            // Assign a value to a property.
            john.Name = "John";

            // Save data to XML file.
            session.Save();
        }
    }
}
